package com.ele.Service.impl;

import com.ele.Dao.DaoImpl.EmployDaoImp;
import com.ele.Pojo.Employee;
import com.ele.Service.EmployeeService;

import java.sql.SQLException;
import java.util.List;

public class EmployeeServiceImpl implements EmployeeService {
    //创建Dao层对象
    EmployDaoImp employDaoImp = new EmployDaoImp();
    //查所有
    @Override
    public List<Employee> getAll() {
        try {
            return employDaoImp.getAll();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    //条件查
    @Override
    public List<Employee> query(String account, String telephone, String nickname) {
        try {
            return employDaoImp.query(account,telephone,nickname);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 添加
     * @param emp
     * @return
     */
    @Override
    public Integer addEmp(Employee emp) {
        try {
            return employDaoImp.addEmp(emp);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    //更新
    @Override
    public Integer updateEmp(Employee emp) {
        try {
            return employDaoImp.update(emp);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
    //删除
    public Integer deleteEmp(String id){
        try {
            return employDaoImp.delete(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Employee empLogin(String account, String password) {
        try {
            return employDaoImp.empLogin(account, password);
        }catch (SQLException e){
            e.printStackTrace();
        }
        return null;
    }

}
